package com.winit.project.core.bean;

import com.alibaba.fastjson.JSONObject;
import com.winit.project.util.ProjectUtil;

import java.util.List;

/**
 * 工程信息,用于向页面返回数据
 * Created by wangjian on 16/1/17.
 */
public class ProjectInfo implements Comparable<ProjectInfo> {

    private String projectName;
    private String vcsPath;
    private String configPath;
    private List<JSONObject> dependency;
    private String vcsType;
    private String packageType;
    private String subModule;
    private String configProjectName;
    private String warName;
    //分支提交测试版本号
    private String qaTestEdition;
    //当前测试通过版本号,只有主干的测试通过分支存在该值,其他分支为空
    private String testPassEdition;
    //工程构建状态
    private String buildStatus;
    //工程推送状态
    private String pushStatus;
    private String pushDesc;
    private String pushEdition;

    private boolean lastPass;

    private String packageName;

    private boolean useSonar = false;

    private String projectDesc;

    private boolean proExist = true;

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getVcsPath() {
        return vcsPath;
    }

    public void setVcsPath(String vcsPath) {
        this.vcsPath = vcsPath;
    }

    public String getConfigPath() {
        return configPath;
    }

    public void setConfigPath(String configPath) {
        this.configPath = configPath;
    }

    public List<JSONObject> getDependency() {
        return dependency;
    }

    public void setDependency(List<JSONObject> dependency) {
        this.dependency = dependency;
    }

    public String getVcsType() {
        return vcsType;
    }

    public void setVcsType(String vcsType) {
        this.vcsType = vcsType;
    }

    public String getPackageType() {
        return packageType;
    }

    public void setPackageType(String packageType) {
        this.packageType = packageType;
    }

    public String getSubModule() {
        return subModule;
    }

    public void setSubModule(String subModule) {
        this.subModule = subModule;
    }

    public String getConfigProjectName() {
        return configProjectName;
    }

    public void setConfigProjectName(String configProjectName) {
        this.configProjectName = configProjectName;
    }

    public String getWarName() {
        return warName;
    }

    public void setWarName(String warName) {
        this.warName = warName;
    }

    public String getQaTestEdition() {
        return qaTestEdition;
    }

    public void setQaTestEdition(String qaTestEdition) {
        this.qaTestEdition = qaTestEdition;
    }

    public String getTestPassEdition() {
        return testPassEdition;
    }

    public void setTestPassEdition(String testPassEdition) {
        this.testPassEdition = testPassEdition;
    }

    public String getBuildStatus() {
        return buildStatus;
    }

    public void setBuildStatus(String buildStatus) {
        this.buildStatus = buildStatus;
    }

    @Override
    public int compareTo(ProjectInfo o) {
        if (ProjectUtil.getTrunkProjectName(this.projectName).equals(ProjectUtil.getTrunkProjectName(o.projectName))) {
            String[] a = this.projectName.split("_");
            String[] b = o.projectName.split("_");
            if (a.length == 1) {
                return -1;
            }
            if (b.length == 1) {
                return 1;
            }
            return a[1].compareTo(b[1]);
        } else {
            return ProjectUtil.getTrunkProjectName(this.projectName).compareTo(ProjectUtil.getTrunkProjectName(o.projectName));
        }
    }

    public String getPushStatus() {
        return pushStatus;
    }

    public void setPushStatus(String pushStatus) {
        this.pushStatus = pushStatus;
    }

    public String getPushDesc() {
        return pushDesc;
    }

    public void setPushDesc(String pushDesc) {
        this.pushDesc = pushDesc;
    }

    public boolean isLastPass() {
        return lastPass;
    }

    public void setLastPass(boolean lastPass) {
        this.lastPass = lastPass;
    }

    public String getPushEdition() {
        return pushEdition;
    }

    public void setPushEdition(String pushEdition) {
        this.pushEdition = pushEdition;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public boolean isUseSonar() {
        return useSonar;
    }

    public void setUseSonar(boolean useSonar) {
        this.useSonar = useSonar;
    }

    public String getProjectDesc() {
        return projectDesc;
    }

    public void setProjectDesc(String projectDesc) {
        this.projectDesc = projectDesc;
    }

    public boolean isProExist() {
        return proExist;
    }

    public void setProExist(boolean proExist) {
        this.proExist = proExist;
    }
}
